package wcpackage.webapplication.view.visural;

import com.visural.wicket.component.nicedit.RichTextEditor;
import com.visural.wicket.component.nicedit.RichTextEditorFormBehavior;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Button;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.Model;
import wcpackage.webapplication.view.BasePage;

/**
 * User: rabbit
 * Date: Jun 3, 2009
 * Time: 10:51:34 PM
 */
public class EditorPage extends BasePage {

    private Label output;
    private RichTextEditor editor;

    public EditorPage() {

        Form form = new Form("form");
        form.add(new RichTextEditorFormBehavior());
        editor = new RichTextEditor("editor", new Model(""));
        form.add(editor);
        add(form);

        form.add(new Button("submit1") {
            @Override
            public void onSubmit() {
                output.setDefaultModel(editor.getModel());
                System.out.println("bum1");
            }
        });

        form.add(new Button("submit2") {
            @Override
            public void onSubmit() {
                output.setDefaultModel(editor.getModel());
                System.out.println("bum2");
            }
        });


        output = new Label("output");
        output.setEscapeModelStrings(false);
        add(output);

    }
}